var dataObj = ""

function tabModFn(data) {
    let {
        title = "表名", text = "", color = ""
    } = data
    let textStr = ""
    console.log("text", text)
    if (text instanceof Array) {
        for (let index = 0; index < text.length; index++) {
            const element = text[index];
            for (var key in element) { //数组对象遍历
                textStr += `<div class='tabModContent'> <span class='tabModContentTitle'>${key}：</span>
              <span class = 'tabModContentText'
              title = "${element[key]}" > ${element[key]}</span></div> `
            }

        }


    } else {
        textStr += `<div class='tabModContent'>
              <span class='tabModContentTitle'></span>
              <span class='tabModContentText' title=""></span>
            </div>`
    }
    dataObj = `<div class="modBody"><div class="tabMod" data-title='表名mod' style="">
          <div class='tabModTitleDiv' data-title='标题栏'>
            <div class='tabModTitle'>
              <div><span class="iconSpan">
                  <i class="icon el-icon-tickets"></i>
                </span>
                <span title = "${title}" >${title}</span>
              </div>
            </div>
            <div></div>
          </div>
          <div class='tabModContentDiv' data-title='内容栏'>
            ${textStr}
          </div>
        </div>
     </div> 
      `;
    return dataObj
}


export default tabModFn;